/**
	This program receives as argument the name of a file containing
	data on completion time of a program in the format:
				num_processing_element  time(ms)
	It produces in output a file containing the information about the scalability
	computed as:
				scal(n)=Tc(1)/Tc(n)
*/
#include <stdio.h>
int main(int argc, char *argv[])
{
	/*
		Mancano tutti i controlli e parametrizzazione
		da fare poi in average e runtest.sh
	*/
	FILE *fin,*fout;
	int num_pe;
	float time_1, time_tmp;
	if(argc<3)
	{
	    fprintf(stderr,"usage: %s inputfile outputfile\n",argv[0]);
	    return -1;
	}
	fin=fopen(argv[1],"r");
	fout=fopen(argv[2],"w");
	fscanf(fin, "%d %f\n",&num_pe,&time_1);
	/*The first row is equal to 1 1*/
	fprintf(fout,"%d %f\n",1,1.0);
	while(!feof(fin))
	{
		fscanf(fin, "%d %f\n",&num_pe,&time_tmp);
		fprintf(fout,"%d %f\n",num_pe,time_1/time_tmp);
	}
	fclose(fin);
	fclose(fout);
}
